/*
* 身份认证系统 /passkey-api
* oa /oa-api
*/
import {useLoginStore} from "@/stores";
import {useOaAppStore} from "@/stores/oa";
import {usePmAppStore} from "@/stores/pm";

export const PasskeyUrlSuffix = '/passkey-api';
export const OaUrlSuffix = '/oa-api';
export const PmUrlSuffix = '/prod-api';
export function useGetAccessToken(url: string): string | null {
  if (url.indexOf(PasskeyUrlSuffix) !== -1) {
    return useLoginStore().getToken();
  } else if (url.indexOf(OaUrlSuffix) !== -1) {
    return useOaAppStore().getToken();
  } else if (url.indexOf(PmUrlSuffix) !== -1) {
    return usePmAppStore().getToken();
  }
  return null;
}
